package com.fl.gulimall.product.configs;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement //开启事务
@MapperScan("com.fl.gulimall.product.dao")
public class mybatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
//      输入页码过大，自动跳转至首页 默认false
        paginationInterceptor.setOverflow(true);
//      每页最大页码 默认500
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
